package com.zhongfl.crm.model.boss;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.zhongfl.crm.annotation.FieldMeta;
import com.zhongfl.crm.enums.boss.OrderStatus;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 客户订单 实体类
 *
 * @author tiantian
 * @date 2018/08/20
 */
@Getter
@Setter
@JsonIgnoreProperties(value = { "hibernateLazyInitializer", "handler" })
public class CustomerOrder implements Serializable {
    private static final long serialVersionUID = -3948200859188670028L;

    public CustomerOrder() {}

    /**
     * 自增ID
     */
    private Integer id;

    /**
     * 励销订单ID
     */
    private Long lxCustomerOrderId;

    /**
     * 客户订单号
     */
    private String customerOrderNo;

    /**
     * 客户姓名
     */
    @FieldMeta(name = "客户姓名")
    private String customerName;

    /**
     * 客户手机号
     */
    private String customerMobile;

    /**
     * 渠道id
     */
    private Integer channelId;

    /**
     * 渠道名称
     */
    @FieldMeta(name = "渠道名称")
    private String channelName;

    /**
     * 贷款金额
     */
    @FieldMeta(name = "贷款金额")
    private BigDecimal loanAmount;

    /**
     * 贷款期限
     */
    @FieldMeta(name = "贷款期限")
    private Integer loanDuration;

    /**
     * 总服务费率
     */
    @FieldMeta(name = "总服务费率")
    private BigDecimal totalFeeRate;

    /**
     * 渠道服务费率
     */
    @FieldMeta(name = "渠道服务费率")
    private BigDecimal channelFeeRate;

    @FieldMeta(name = "融资服务费率")
    private BigDecimal loanServiceRate;

    @FieldMeta(name = "贷后管理服务费率")
    private BigDecimal postLoanServiceRate;

    /**
     * 客户订单状态
     */
    @FieldMeta(name = "订单状态")
    private String customerOrderStatus;

    private OrderStatus khOrderStatus;
    public OrderStatus getKhOrderStatus() {
        for (OrderStatus orderStatus : OrderStatus.values()) {
            if (customerOrderStatus.equals(orderStatus.name())) {
                return orderStatus;
            }
        }
        return null;
    }

    private String customerOrderStatusName;
    public String getCustomerOrderStatusName() {
        for (OrderStatus orderStatus : OrderStatus.values()) {
            if (customerOrderStatus.equals(orderStatus.name())) {
                return orderStatus.getValue();
            }
        }
        return "";
    }

    /**
     * 面谈日期
     */
    @FieldMeta(name = "面谈日期")
    private Date interviewDate;

    /**
     * 商务经理阿米巴ID
     */
    private Integer businessManagerAmibaId;
    private String businessManagerAmibaName;

    /**
     * 商务经理staffCode
     */
    private String businessManagerStaffCode;

    /**
     * 商务经理姓名
     */
    @FieldMeta(name = "商务经理")
    private String businessManagerStaffName;

    /**
     * 商务助理staffCode
     */
    private String businessAssistantStaffCode;

    /**
     * 商务助理姓名
     */
    @FieldMeta(name = "商务助理")
    private String businessAssistantStaffName;

    /**
     * 商务助理手机号
     */
    private String businessAssistantStaffMobile;

    /**
     * 交付订单号,多条以逗号分割
     */
    private String deliveryOrderNoList;
    private List<Order> deliveryOrders;

    /**
     * 最新交付订单号
     */
    private String latestDeliveryOrderNo;

    /**
     * 最新交付订单状态
     */
    private String latestDeliveryOrderStatus;

    /**
     * 逻辑删除标记 0：未删除；1：已删除
     */
    private Integer deleted;

    /**
     * 创建人
     */
    private String createdBy;

    /**
     * 创建时间
     */
    private Date createdAt;

    /**
     * 最后更新人
     */
    private String updatedBy;

    /**
     * 最后更新时间
     */
    private Date updatedAt;

    private String currentStaffCode;
}